package day08.edu;

import java.util.Scanner;
import java.util.Vector;

// Created: 09/08/2025, ChangJiang Ru
public class ScoreTest {
    public static void main(String[] args)
    {
        Vector v = new Vector();
        Scanner scan = new Scanner(System.in);
        System.out.println("Please input the score number:");

        int maxScore = 0;
        while(true)
        {
            // Get the score and add to the vector
            int intScore = scan.nextInt();
            // the condition of end
            if(intScore < 0)
            {
                break;
            }

            /*
            // Case 1: packing
            Integer integerScore = Integer.valueOf(intScore);
            v.addElement(integerScore);
             */

            // Case 2: automatically packing
            v.addElement(intScore);

            if(intScore > maxScore)
            {
                maxScore = intScore;
            }
        }

        System.out.println("The max number is : " + maxScore);

        for (int i = 0; i < v.size(); i++) {
            Object objectScore = v.elementAt(i);

            Integer integerScore = (Integer)objectScore;
            int intScore = integerScore.intValue();

            char grade = ' ';
            if(maxScore - intScore <= 10)
            {
                grade = 'A';
            }else if(maxScore - intScore <= 20)
            {
                grade = 'B';
            }else if(maxScore - intScore <= 30)
            {
                grade = 'C';
            }else
            {
                grade = 'D';
            }

            System.out.println("Student " + i + " score is " + intScore + "grade is " + grade);
        }




        scan.close();
    }
}
